package com.sd.springboot.experiment_1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.http.converter.HttpMessageConverter;

import java.util.List;

@SpringBootApplication
public class Experiment1Application {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Experiment1Application.class, args);
        String[] beanDefinitionNames = run.getBeanDefinitionNames();

        // 获取到容器中的HttpsMessageConverters
        HttpMessageConverters httpMessageConverters = run.getBean(HttpMessageConverters.class);
        List<HttpMessageConverter<?>> converters = httpMessageConverters.getConverters();
        // 将这些Converter输出
        for (int i = 0; i < converters.size(); i++) {
            System.out.println("converters[" + i + "]" + " = " + converters.get(i));
        }


    }


}
